<?php

//UMA new
namespace App\Listeners;

use App\Events\ContactInfoSaved;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Services\KintoneService;
use App\Traits\TestLog;

class SaveInfoToKintone
{
    use TestLog;
    
    /**
     * 事件监听
     * イベントリスナー
     * @return void
     */
    private $kintoneService;

    public function __construct(KintoneService $kintoneService)
    {
        $this->kintoneService = $kintoneService;
    }

    /**
     * 处理事件
     * イベントハンドラ
     * @param  ContactInfoSaved  $event
     * @return mixed
     */
    public function handle(ContactInfoSaved $event)
    {
        $info = $event->info;
        $this->kintoneService->saveInfo($info->getKintoneData());
    }
}
